﻿using System;
using System.Data;
using System.Data.SqlClient;
using System.Collections.Generic;
using StockTrader.DAL.IDAL;
using StockTrader.DAL.MSSQLHelper;
using StockTrader.BusinessService.DataContract;
using StockTrader.DAL.HastcAdapter.FileParser.Structure;

namespace StockTrader.DAL.SQLserver
{
    public class StsStocks 
    {
        private SqlConnection _internalConnection;
        private SqlTransaction _internalADOTransaction = null;

        public void BeginADOTransaction()
        {
            if (_internalConnection.State != System.Data.ConnectionState.Open)
                _internalConnection.Open();
            _internalADOTransaction = _internalConnection.BeginTransaction(System.Data.IsolationLevel.ReadCommitted);
        }
        public void RollBackTransaction()
        {
            _internalADOTransaction.Rollback();
            _internalADOTransaction = null;
        }
        public void CommitADOTransaction()
        {
            _internalADOTransaction.Commit();
            _internalADOTransaction = null;
        }
        public void Open(string connString)
        {
            if (_internalConnection == null)
                _internalConnection = new SqlConnection(connString);
            if (_internalConnection.State != ConnectionState.Open)
                _internalConnection.Open();
        }
        public void Close()
        {
            if (_internalConnection != null && _internalConnection.State != System.Data.ConnectionState.Closed)
                _internalConnection.Close();
        }

        #region Parameters
        private const string PARM_FLOOR_CODE = "@FLOOR_CODE";
        private const string PARM_DATE_NO = "@DATE_NO";
        private const string PARM_TRADING_DATE = "@TRADING_DATE";
        private const string PARM_CURRENT_STATUS = "@CURRENT_STATUS";
        private const string PARM_TIME = "@TIME";
        private const string PARM_TOTAL_TRADE = "@TOTAL_TRADE";
        private const string PARM_TOTAL_STOCK = "@TOTAL_STOCK";
        private const string PARM_TOTAL_QTTY = "@TOTAL_QTTY";
        private const string PARM_TOTAL_VALUE = "@TOTAL_VALUE";
        private const string PARM_ADVANCES = "@ADVANCES";
        private const string PARM_NOCHANGE = "@NOCHANGE";
        private const string PARM_DECLINES = "@DECLINES";
        private const string PARM_PRIOR_MARKET_INDEX = "@PRIOR_MARKET_INDEX";
        private const string PARM_CHG_INDEX = "@CHG_INDEX";
        private const string PARM_PCT_INDEX = "@PCT_INDEX";
        private const string PARM_CURRENT_INDEX = "@CURRENT_INDEX";
        private const string PARM_MARKET_INDEX = "@MARKET_INDEX";
        private const string PARM_SESSION_NO = "@SESSION_NO";
        private const string PARM_PRV_PRIOR_MARKET_INDEX = "@PRV_PRIOR_MARKET_INDEX";
        private const string PARM_AVR_MARKET_INDEX = "@AVR_MARKET_INDEX";
        private const string PARM_AVR_PRIOR_MARKET_INDEX = "@AVR_PRIOR_MARKET_INDEX";
        private const string PARM_AVR_CHG_INDEX = "@AVR_CHG_INDEX";
        private const string PARM_AVR_PCT_INDEX = "@AVR_PCT_INDEX";
        private const string PARM_PT_TOTAL_QTTY = "@PT_TOTAL_QTTY";
        private const string PARM_PT_TOTAL_VALUE = "@PT_TOTAL_VALUE";
        private const string PARM_PT_TOTAL_TRADE = "@PT_TOTAL_TRADE";

        private const string PARM_ORDER_NO = "@ORDER_NO";
        private const string PARM_ORDER_DATE = "@ORDER_DATE";
        private const string PARM_ORDER_TIME = "@ORDER_TIME";
        private const string PARM_MEMBER_ID = "@MEMBER_ID";
        private const string PARM_ACCOUNT_ID = "@ACCOUNT_ID";
        private const string PARM_STOCK_ID = "@STOCK_ID";
        private const string PARM_ORDER_TYPE = "@ORDER_TYPE";
        private const string PARM_PRIORITY = "@PRIORITY";
        private const string PARM_OORB = "@OORB";
        private const string PARM_NORP = "@NORP";
        private const string PARM_NORC = "@NORC";
        private const string PARM_BORE = "@BORE";
        private const string PARM_AORI = "@AORI";
        private const string PARM_SETTLEMENT_TYPE = "@SETTLEMENT_TYPE";
        private const string PARM_DORF = "@DORF";
        private const string PARM_ORDER_QTTY = "@ORDER_QTTY";
        private const string PARM_ORDER_PRICE = "@ORDER_PRICE";
        private const string PARM_STATUS = "@STATUS";
        private const string PARM_QUOTE_PRICE = "@QUOTE_PRICE";
        private const string PARM_QUOTE_TIME = "@QUOTE_TIME";
        private const string PARM_QUOTE_QTTY = "@QUOTE_QTTY";
        private const string PARM_ACCOUNT_NO = "@ACCOUNT_NO";
        private const string PARM_BROKER_ID = "@BROKER_ID";
        private const string PARM_TELEPHONE = "@TELEPHONE";
        private const string PARM_SETTLE_DAY = "@SETTLE_DAY";
        private const string PARM_AORC = "@AORC";
        private const string PARM_YIELDMAT = "@YIELDMAT";
        private const string PARM_CODE_TRADE = "@CODE_TRADE";

        private const string PARM_STOCK_INFO_ID = "@STOCK_INFO_ID";
        private const string PARM_CODE = "@CODE";
        private const string PARM_STOCK_TYPE = "@STOCK_TYPE";
        private const string PARM_TOTAL_LISTING_QTTY = "@TOTAL_LISTING_QTTY";
        private const string PARM_TRADING_UNIT = "@TRADING_UNIT";
        private const string PARM_LISTTING_STATUS = "@LISTTING_STATUS";
        private const string PARM_ADJUST_QTTY = "@ADJUST_QTTY";
        private const string PARM_REFERENCE_STATUS = "@REFERENCE_STATUS";
        private const string PARM_ADJUST_RATE = "@ADJUST_RATE";
        private const string PARM_DIVIDENT_RATE = "@DIVIDENT_RATE";
        private const string PARM_TOTAL_ROOM = "@TOTAL_ROOM";
        private const string PARM_CURRENT_ROOM = "@CURRENT_ROOM";
        private const string PARM_BASIC_PRICE = "@BASIC_PRICE";
        private const string PARM_OPEN_PRICE = "@OPEN_PRICE";
        private const string PARM_CLOSE_PRICE = "@CLOSE_PRICE";
        private const string PARM_CURRENT_PRICE = "@CURRENT_PRICE";
        private const string PARM_CURRENT_QTTY = "@CURRENT_QTTY";
        private const string PARM_HIGHEST_PRICE = "@HIGHEST_PRICE";
        private const string PARM_LOWEST_PRICE = "@LOWEST_PRICE";
        private const string PARM_BEST_OFFER_PRICE = "@BEST_OFFER_PRICE";
        private const string PARM_BEST_BID_PRICE = "@BEST_BID_PRICE";
        private const string PARM_CEILING_PRICE = "@CEILING_PRICE";
        private const string PARM_FLOOR_PRICE = "@FLOOR_PRICE";
        private const string PARM_TOTAL_OFFER_QTTY = "@TOTAL_OFFER_QTTY";
        private const string PARM_TOTAL_BID_QTTY = "@TOTAL_BID_QTTY";
        private const string PARM_BEST_OFFER_QTTY = "@BEST_OFFER_QTTY";
        private const string PARM_BEST_BID_QTTY = "@BEST_BID_QTTY";
        private const string PARM_PRIOR_PRICE = "@PRIOR_PRICE";
        private const string PARM_PRIOR_CLOSE_PRICE = "@PRIOR_CLOSE_PRICE";
        private const string PARM_MATCH_PRICE = "@MATCH_PRICE";
        private const string PARM_MATCH_QTTY = "@MATCH_QTTY";
        private const string PARM_DELETED = "@DELETED";
        private const string PARM_DATE_CREATED = "@DATE_CREATED";
        private const string PARM_DATE_MODIFIED = "@DATE_MODIFIED";
        private const string PARM_MODIFIED_BY = "@MODIFIED_BY";
        private const string PARM_CREATED_BY = "@CREATED_BY";
        private const string PARM_NAME = "@NAME";
        private const string PARM_PARVALUE = "@PARVALUE";
        private const string PARM_MATCH_VALUE = "@MATCH_VALUE";
        private const string PARM_IS_CALCINDEX = "@IS_CALCINDEX";
        private const string PARM_IS_DETERMINECL = "@IS_DETERMINECL";
        private const string PARM_OFFER_COUNT = "@OFFER_COUNT";
        private const string PARM_BID_COUNT = "@BID_COUNT";
        private const string PARM_AVERAGE_PRICE = "@AVERAGE_PRICE";
        private const string PARM_INDEX_PRICE = "@INDEX_PRICE";
        private const string PARM_PREV_PRIOR_PRICE = "@PREV_PRIOR_PRICE";
        private const string PARM_PREV_PRIOR_CLOSE_PRICE = "@PREV_PRIOR_CLOSE_PRICE";
        private const string PARM_NM_TOTAL_TRADED_VALUE = "@NM_TOTAL_TRADED_VALUE";
        private const string PARM_PT_MATCH_QTTY = "@PT_MATCH_QTTY";
        private const string PARM_PT_MATCH_PRICE = "@PT_MATCH_PRICE";
        private const string PARM_PT_TOTAL_TRADED_QTTY = "@PT_TOTAL_TRADED_QTTY";
        private const string PARM_PT_TOTAL_TRADED_VALUE = "@PT_TOTAL_TRADED_VALUE";
        private const string PARM_TOTAL_BUY_TRADING_QTTY = "@TOTAL_BUY_TRADING_QTTY";
        private const string PARM_BUY_COUNT = "@BUY_COUNT";
        private const string PARM_TOTAL_BUY_TRADING_VALUE = "@TOTAL_BUY_TRADING_VALUE";
        private const string PARM_TOTAL_SELL_TRADING_QTTY = "@TOTAL_SELL_TRADING_QTTY";
        private const string PARM_SELL_COUNT = "@SELL_COUNT";
        private const string PARM_TOTAL_SELL_TRADING_VALUE = "@TOTAL_SELL_TRADING_VALUE";
        private const string PARM_TOTAL_TRADING_QTTY = "@TOTAL_TRADING_QTTY";
        private const string PARM_TOTAL_TRADING_VALUE = "@TOTAL_TRADING_VALUE";
        private const string PARM_BUY_FOREIGN_QTTY = "@BUY_FOREIGN_QTTY";
        private const string PARM_BUY_FOREIGN_VALUE = "@BUY_FOREIGN_VALUE";
        private const string PARM_SELL_FOREIGN_QTTY = "@SELL_FOREIGN_QTTY";
        private const string PARM_SELL_FOREIGN_VALUE = "@SELL_FOREIGN_VALUE";
        private const string PARM_REMAIN_FOREIGN_QTTY = "@REMAIN_FOREIGN_QTTY";
        private const string PARM_PT_YIELDMAT = "@PT_YIELDMAT";

        private const string PARM_B_ORD_QTTY_3 = "@B_ORD_QTTY_3";
        private const string PARM_B_ORD_PRICE_3 = "@B_ORD_PRICE_3";
        private const string PARM_B_ORD_QTTY_2 = "@B_ORD_QTTY_2";
        private const string PARM_B_ORD_PRICE_2 = "@B_ORD_PRICE_2";
        private const string PARM_B_ORD_QTTY_1 = "@B_ORD_QTTY_1";
        private const string PARM_B_ORD_PRICE_1 = "@B_ORD_PRICE_1";
        private const string PARM_S_ORD_PRICE_1 = "@S_ORD_PRICE_1";
        private const string PARM_S_ORD_QTTY_1 = "@S_ORD_QTTY_1";
        private const string PARM_S_ORD_PRICE_2 = "@S_ORD_PRICE_2";
        private const string PARM_S_ORD_QTTY_2 = "@S_ORD_QTTY_2";
        private const string PARM_S_ORD_PRICE_3 = "@S_ORD_PRICE_3";
        private const string PARM_S_ORD_QTTY_3 = "@S_ORD_QTTY_3";

        private const string PARM_CONFIRM_NO = "@CONFIRM_NO";
        private const string PARM_B_ORDER_NO = "@B_ORDER_NO";
        private const string PARM_B_ORDER_DATE = "@B_ORDER_DATE";
        private const string PARM_S_ORDER_NO = "@S_ORDER_NO";
        private const string PARM_S_ORDER_DATE = "@S_ORDER_DATE";
        private const string PARM_B_NEXT_CNFRM = "@B_NEXT_CNFRM";
        private const string PARM_S_NEXT_CNFRM = "@S_NEXT_CNFRM";
        private const string PARM_MATCH_TIME = "@MATCH_TIME";
        private const string PARM_MATCH_DATE = "@MATCH_DATE";
        private const string PARM_B_TRADING_ID = "@B_TRADING_ID";
        private const string PARM_S_TRADING_ID = "@S_TRADING_ID";
        private const string PARM_B_CODE_TRADE = "@B_CODE_TRADE";
        private const string PARM_S_CODE_TRADE = "@S_CODE_TRADE";
        private const string PARM_SEC_CODE = "@SEC_CODE";
        private const string PARM_QUANTITY = "@QUANTITY";
        private const string PARM_PRICE = "@PRICE";
        private const string PARM_B_ACCOUNT_NO = "@B_ACCOUNT_NO";
        private const string PARM_S_ACCOUNT_NO = "@S_ACCOUNT_NO";
        private const string PARM_SETT_TYPE = "@SETT_TYPE";
        private const string PARM_SETT_DATE = "@SETT_DATE";
        private const string PARM_B_PC_FLAG = "@B_PC_FLAG";
        private const string PARM_S_PC_FLAG = "@S_PC_FLAG";

        private const string PARM_ORDER_QTTY_SELL = "@ORDER_QTTY_SELL";
        private const string PARM_ORDER_PRICE_SELL = "@ORDER_PRICE_SELL";
        private const string PARM_YIELDMAT_SELL = "@YIELDMAT_SELL";
        private const string PARM_ORDER_QTTY_BUY= "@ORDER_QTTY_BUY";
        private const string PARM_ORDER_PRICE_BUY = "@ORDER_PRICE_BUY";
        private const string PARM_YIELDMAT_BUY = "@YIELDMAT_BUY";

        #endregion

        #region IStsStocks Members


        public int CountSTS_STOCKSINFO()
        {
            try
            {
                return Convert.ToInt32(SQLHelper.ExecuteScalar(_internalConnection, _internalADOTransaction, CommandType.StoredProcedure, "CountSTS_STOCKSINFO"));
            }
            catch
            {
                throw;
            }
        }

        public void DeleteSTS_STOCKSINFO()
        {
            try
            {
                SQLHelper.ExecuteNonQuery(_internalConnection, _internalADOTransaction, CommandType.StoredProcedure, "DeleteSTS_STOCKSINFO");
            }
            catch
            {
                throw;
            }
        }

        public void InsertSTS_STOCKSINFO(STS_STOCKSINFO item)
        {
            try
            {
                SqlParameter[] parms = new SqlParameter[] { 
                        new SqlParameter( PARM_STOCK_INFO_ID,SqlDbType.Decimal),
                        new SqlParameter( PARM_TRADING_DATE,SqlDbType.DateTime),
                        new SqlParameter( PARM_TIME,SqlDbType.VarChar),
                        new SqlParameter( PARM_STOCK_ID,SqlDbType.Decimal),
                        new SqlParameter( PARM_CODE,SqlDbType.VarChar),
                        new SqlParameter( PARM_STOCK_TYPE,SqlDbType.Decimal),
                        new SqlParameter( PARM_TOTAL_LISTING_QTTY,SqlDbType.Decimal),
                        new SqlParameter( PARM_TRADING_UNIT,SqlDbType.Decimal),
                        new SqlParameter( PARM_LISTTING_STATUS,SqlDbType.Decimal),
                        new SqlParameter( PARM_ADJUST_QTTY,SqlDbType.Decimal),
                        new SqlParameter( PARM_REFERENCE_STATUS,SqlDbType.Decimal),
                        new SqlParameter( PARM_ADJUST_RATE,SqlDbType.Decimal),
                        new SqlParameter( PARM_DIVIDENT_RATE,SqlDbType.Decimal),
                        new SqlParameter( PARM_STATUS,SqlDbType.Decimal),
                        new SqlParameter( PARM_TOTAL_ROOM,SqlDbType.Decimal),
                        new SqlParameter( PARM_CURRENT_ROOM,SqlDbType.Decimal),
                        new SqlParameter( PARM_BASIC_PRICE,SqlDbType.Decimal),
                        new SqlParameter( PARM_OPEN_PRICE,SqlDbType.Decimal),
                        new SqlParameter( PARM_CLOSE_PRICE,SqlDbType.Decimal),
                        new SqlParameter( PARM_CURRENT_PRICE,SqlDbType.Decimal),
                        new SqlParameter( PARM_CURRENT_QTTY,SqlDbType.Decimal),
                        new SqlParameter( PARM_HIGHEST_PRICE,SqlDbType.Decimal),
                        new SqlParameter( PARM_LOWEST_PRICE,SqlDbType.Decimal),
                        new SqlParameter( PARM_BEST_OFFER_PRICE,SqlDbType.Decimal),
                        new SqlParameter( PARM_BEST_BID_PRICE,SqlDbType.Decimal),
                        new SqlParameter( PARM_CEILING_PRICE,SqlDbType.Decimal),
                        new SqlParameter( PARM_FLOOR_PRICE,SqlDbType.Decimal),
                        new SqlParameter( PARM_TOTAL_OFFER_QTTY,SqlDbType.Decimal),
                        new SqlParameter( PARM_TOTAL_BID_QTTY,SqlDbType.Decimal),
                        new SqlParameter( PARM_BEST_OFFER_QTTY,SqlDbType.Decimal),
                        new SqlParameter( PARM_BEST_BID_QTTY,SqlDbType.Decimal),
                        new SqlParameter( PARM_PRIOR_PRICE,SqlDbType.Decimal),
                        new SqlParameter( PARM_PRIOR_CLOSE_PRICE,SqlDbType.Decimal),
                        new SqlParameter( PARM_MATCH_PRICE,SqlDbType.Decimal),
                        new SqlParameter( PARM_MATCH_QTTY,SqlDbType.Decimal),
                        new SqlParameter( PARM_DELETED,SqlDbType.Decimal),
                        new SqlParameter( PARM_DATE_CREATED,SqlDbType.DateTime),
                        new SqlParameter( PARM_DATE_MODIFIED,SqlDbType.DateTime),
                        new SqlParameter( PARM_MODIFIED_BY,SqlDbType.VarChar),
                        new SqlParameter( PARM_CREATED_BY,SqlDbType.VarChar),
                        new SqlParameter( PARM_NAME,SqlDbType.NVarChar),
                        new SqlParameter( PARM_PARVALUE,SqlDbType.Decimal),
                        new SqlParameter( PARM_MATCH_VALUE,SqlDbType.Decimal),
                        new SqlParameter( PARM_FLOOR_CODE,SqlDbType.Decimal),
                        new SqlParameter( PARM_IS_CALCINDEX,SqlDbType.Decimal),
                        new SqlParameter( PARM_IS_DETERMINECL,SqlDbType.Decimal),
                        new SqlParameter( PARM_DATE_NO,SqlDbType.Decimal),
                        new SqlParameter( PARM_OFFER_COUNT,SqlDbType.Decimal),
                        new SqlParameter( PARM_BID_COUNT,SqlDbType.Decimal),
                        new SqlParameter( PARM_AVERAGE_PRICE,SqlDbType.Decimal),
                        new SqlParameter( PARM_INDEX_PRICE,SqlDbType.Decimal),
                        new SqlParameter( PARM_PREV_PRIOR_PRICE,SqlDbType.Decimal),
                        new SqlParameter( PARM_YIELDMAT,SqlDbType.Decimal),
                        new SqlParameter( PARM_PREV_PRIOR_CLOSE_PRICE,SqlDbType.Decimal),
                        new SqlParameter( PARM_NM_TOTAL_TRADED_VALUE,SqlDbType.Decimal),
                        new SqlParameter( PARM_PT_MATCH_QTTY,SqlDbType.Decimal),
                        new SqlParameter( PARM_PT_MATCH_PRICE,SqlDbType.Decimal),
                        new SqlParameter( PARM_PT_TOTAL_TRADED_QTTY,SqlDbType.Decimal),
                        new SqlParameter( PARM_PT_TOTAL_TRADED_VALUE,SqlDbType.Decimal),
                        new SqlParameter( PARM_TOTAL_BUY_TRADING_QTTY,SqlDbType.Decimal),
                        new SqlParameter( PARM_BUY_COUNT,SqlDbType.Decimal),
                        new SqlParameter( PARM_TOTAL_BUY_TRADING_VALUE,SqlDbType.Decimal),
                        new SqlParameter( PARM_TOTAL_SELL_TRADING_QTTY,SqlDbType.Decimal),
                        new SqlParameter( PARM_SELL_COUNT,SqlDbType.Decimal),
                        new SqlParameter( PARM_TOTAL_SELL_TRADING_VALUE,SqlDbType.Decimal),
                        new SqlParameter( PARM_TOTAL_TRADING_QTTY,SqlDbType.Decimal),
                        new SqlParameter( PARM_TOTAL_TRADING_VALUE,SqlDbType.Decimal),
                        new SqlParameter( PARM_BUY_FOREIGN_QTTY,SqlDbType.Decimal),
                        new SqlParameter( PARM_BUY_FOREIGN_VALUE,SqlDbType.Decimal),
                        new SqlParameter( PARM_SELL_FOREIGN_QTTY,SqlDbType.Decimal),
                        new SqlParameter( PARM_SELL_FOREIGN_VALUE,SqlDbType.Decimal),
                        new SqlParameter( PARM_REMAIN_FOREIGN_QTTY,SqlDbType.Decimal),
                        new SqlParameter( PARM_PT_YIELDMAT,SqlDbType.Decimal)
                };

                parms[0].Value = item.STOCK_INFO_ID;
                parms[1].Value = item.TRADING_DATE;
                parms[2].Value = item.TIME;
                parms[3].Value = item.STOCK_ID;
                parms[4].Value = item.CODE;
                parms[5].Value = item.STOCK_TYPE;
                parms[6].Value = item.TOTAL_LISTING_QTTY;
                parms[7].Value = item.TRADING_UNIT;
                parms[8].Value = item.LISTTING_STATUS;
                parms[9].Value = item.ADJUST_QTTY;
                parms[10].Value = item.REFERENCE_STATUS;
                parms[11].Value = item.ADJUST_RATE;
                parms[12].Value = item.DIVIDENT_RATE;
                parms[13].Value = item.STATUS;
                parms[14].Value = item.TOTAL_ROOM;
                parms[15].Value = item.CURRENT_ROOM;
                parms[16].Value = item.BASIC_PRICE;
                parms[17].Value = item.OPEN_PRICE;
                parms[18].Value = item.CLOSE_PRICE;
                parms[19].Value = item.CURRENT_PRICE;
                parms[20].Value = item.CURRENT_QTTY;
                parms[21].Value = item.HIGHEST_PRICE;
                parms[22].Value = item.LOWEST_PRICE;
                parms[23].Value = item.BEST_OFFER_PRICE;
                parms[24].Value = item.BEST_BID_PRICE;
                parms[25].Value = item.CEILING_PRICE;
                parms[26].Value = item.FLOOR_PRICE;
                parms[27].Value = item.TOTAL_OFFER_QTTY;
                parms[28].Value = item.TOTAL_BID_QTTY;
                parms[29].Value = item.BEST_OFFER_QTTY;
                parms[30].Value = item.BEST_BID_QTTY;
                parms[31].Value = item.PRIOR_PRICE;
                parms[32].Value = item.PRIOR_CLOSE_PRICE;
                parms[33].Value = item.MATCH_PRICE;
                parms[34].Value = item.MATCH_QTTY;
                parms[35].Value = item.DELETED;
                parms[36].Value = DateTime.Now; //item.DATE_CREATED;
                parms[37].Value = DateTime.Now;// item.DATE_MODIFIED;
                parms[38].Value = (item.MODIFIED_BY == null) ? "" : item.MODIFIED_BY;
                parms[39].Value = (item.CREATED_BY == null) ? "" : item.CREATED_BY;
                parms[40].Value = item.NAME;
                parms[41].Value = item.PARVALUE;
                parms[42].Value = item.MATCH_VALUE;
                parms[43].Value = item.FLOOR_CODE;
                parms[44].Value = item.IS_CALCINDEX;
                parms[45].Value = item.IS_DETERMINECL;
                parms[46].Value = item.DATE_NO;
                parms[47].Value = item.OFFER_COUNT;
                parms[48].Value = item.BID_COUNT;
                parms[49].Value = item.AVERAGE_PRICE;
                parms[50].Value = item.INDEX_PRICE;
                parms[51].Value = item.PREV_PRIOR_PRICE;
                parms[52].Value = item.YIELDMAT;
                parms[53].Value = item.PREV_PRIOR_CLOSE_PRICE;
                parms[54].Value = item.NM_TOTAL_TRADED_VALUE;
                parms[55].Value = item.PT_MATCH_QTTY;
                parms[56].Value = item.PT_MATCH_PRICE;
                parms[57].Value = item.PT_TOTAL_TRADED_QTTY;
                parms[58].Value = item.PT_TOTAL_TRADED_VALUE;
                parms[59].Value = item.TOTAL_BUY_TRADING_QTTY;
                parms[60].Value = item.BUY_COUNT;
                parms[61].Value = item.TOTAL_BUY_TRADING_VALUE;
                parms[62].Value = item.TOTAL_SELL_TRADING_QTTY;
                parms[63].Value = item.SELL_COUNT;
                parms[64].Value = item.TOTAL_SELL_TRADING_VALUE;
                parms[65].Value = item.TOTAL_TRADING_QTTY;
                parms[66].Value = item.TOTAL_TRADING_VALUE;
                parms[67].Value = item.BUY_FOREIGN_QTTY;
                parms[68].Value = item.BUY_FOREIGN_VALUE;
                parms[69].Value = item.SELL_FOREIGN_QTTY;
                parms[70].Value = item.SELL_FOREIGN_VALUE;
                parms[71].Value = item.REMAIN_FOREIGN_QTTY;
                parms[72].Value = item.PT_YIELDMAT;

                SQLHelper.ExecuteNonQuery(_internalConnection, _internalADOTransaction, CommandType.StoredProcedure, "InsertSTS_STOCKSINFO", parms);
            }
            catch (Exception ex)
            {
                throw;
            }
        }

        public void UpdateSTS_STOCKSINFO(STS_STOCKSINFO item)
        {
            try
            {
                SqlParameter[] parms = new SqlParameter[] { 
                                new SqlParameter( PARM_TRADING_DATE,SqlDbType.DateTime),
                                new SqlParameter( PARM_TIME,SqlDbType.VarChar),
                                new SqlParameter( PARM_CURRENT_ROOM,SqlDbType.Decimal),
                                new SqlParameter( PARM_OPEN_PRICE,SqlDbType.Decimal),
                                new SqlParameter( PARM_CLOSE_PRICE,SqlDbType.Decimal),
                                new SqlParameter( PARM_CURRENT_PRICE,SqlDbType.Decimal),
                                new SqlParameter( PARM_CURRENT_QTTY,SqlDbType.Decimal),
                                new SqlParameter( PARM_HIGHEST_PRICE,SqlDbType.Decimal),
                                new SqlParameter( PARM_LOWEST_PRICE,SqlDbType.Decimal),
                                new SqlParameter( PARM_BEST_OFFER_PRICE,SqlDbType.Decimal),
                                new SqlParameter( PARM_BEST_BID_PRICE,SqlDbType.Decimal),
                                new SqlParameter( PARM_TOTAL_OFFER_QTTY,SqlDbType.Decimal),
                                new SqlParameter( PARM_TOTAL_BID_QTTY,SqlDbType.Decimal),
                                new SqlParameter( PARM_BEST_OFFER_QTTY,SqlDbType.Decimal),
                                new SqlParameter( PARM_BEST_BID_QTTY,SqlDbType.Decimal),
                                new SqlParameter( PARM_PRIOR_PRICE,SqlDbType.Decimal),
                                new SqlParameter( PARM_PRIOR_CLOSE_PRICE,SqlDbType.Decimal),
                                new SqlParameter( PARM_MATCH_PRICE,SqlDbType.Decimal),
                                new SqlParameter( PARM_MATCH_QTTY,SqlDbType.Decimal),
                                new SqlParameter( PARM_MATCH_VALUE,SqlDbType.Decimal),
                                new SqlParameter( PARM_OFFER_COUNT,SqlDbType.Decimal),
                                new SqlParameter( PARM_BID_COUNT,SqlDbType.Decimal),
                                new SqlParameter( PARM_AVERAGE_PRICE,SqlDbType.Decimal),
                                new SqlParameter( PARM_INDEX_PRICE,SqlDbType.Decimal),
                                new SqlParameter( PARM_PREV_PRIOR_PRICE,SqlDbType.Decimal),
                                new SqlParameter( PARM_PREV_PRIOR_CLOSE_PRICE,SqlDbType.Decimal),
                                new SqlParameter( PARM_NM_TOTAL_TRADED_VALUE,SqlDbType.Decimal),
                                new SqlParameter( PARM_PT_MATCH_QTTY,SqlDbType.Decimal),
                                new SqlParameter( PARM_PT_MATCH_PRICE,SqlDbType.Decimal),
                                new SqlParameter( PARM_PT_TOTAL_TRADED_QTTY,SqlDbType.Decimal),
                                new SqlParameter( PARM_PT_TOTAL_TRADED_VALUE,SqlDbType.Decimal),
                                new SqlParameter( PARM_TOTAL_BUY_TRADING_QTTY,SqlDbType.Decimal),
                                new SqlParameter( PARM_BUY_COUNT,SqlDbType.Decimal),
                                new SqlParameter( PARM_TOTAL_BUY_TRADING_VALUE,SqlDbType.Decimal),
                                new SqlParameter( PARM_TOTAL_SELL_TRADING_QTTY,SqlDbType.Decimal),
                                new SqlParameter( PARM_SELL_COUNT,SqlDbType.Decimal),
                                new SqlParameter( PARM_TOTAL_SELL_TRADING_VALUE,SqlDbType.Decimal),
                                new SqlParameter( PARM_TOTAL_TRADING_QTTY,SqlDbType.Decimal),
                                new SqlParameter( PARM_TOTAL_TRADING_VALUE,SqlDbType.Decimal),
                                new SqlParameter( PARM_BUY_FOREIGN_QTTY,SqlDbType.Decimal),
                                new SqlParameter( PARM_BUY_FOREIGN_VALUE,SqlDbType.Decimal),
                                new SqlParameter( PARM_SELL_FOREIGN_QTTY,SqlDbType.Decimal),
                                new SqlParameter( PARM_SELL_FOREIGN_VALUE,SqlDbType.Decimal),
                                new SqlParameter( PARM_REMAIN_FOREIGN_QTTY,SqlDbType.Decimal),
                                new SqlParameter( PARM_CODE,SqlDbType.VarChar)
                };

                parms[0].Value = item.TRADING_DATE;
                parms[1].Value = item.TIME;
                parms[2].Value = item.CURRENT_ROOM;
                parms[3].Value = item.OPEN_PRICE;
                parms[4].Value = item.CLOSE_PRICE;
                parms[5].Value = item.CURRENT_PRICE;
                parms[6].Value = item.CURRENT_QTTY;
                parms[7].Value = item.HIGHEST_PRICE;
                parms[8].Value = item.LOWEST_PRICE;
                parms[9].Value = item.BEST_OFFER_PRICE;
                parms[10].Value = item.BEST_BID_PRICE;
                parms[11].Value = item.TOTAL_OFFER_QTTY;
                parms[12].Value = item.TOTAL_BID_QTTY;
                parms[13].Value = item.BEST_OFFER_QTTY;
                parms[14].Value = item.BEST_BID_QTTY;
                parms[15].Value = item.PRIOR_PRICE;
                parms[16].Value = item.PRIOR_CLOSE_PRICE;
                parms[17].Value = item.MATCH_PRICE;
                parms[18].Value = item.MATCH_QTTY;
                parms[19].Value = item.MATCH_VALUE;
                parms[20].Value = item.OFFER_COUNT;
                parms[21].Value = item.BID_COUNT;
                parms[22].Value = item.AVERAGE_PRICE;
                parms[23].Value = item.INDEX_PRICE;
                parms[24].Value = item.PREV_PRIOR_PRICE;
                parms[25].Value = item.PREV_PRIOR_CLOSE_PRICE;
                parms[26].Value = item.NM_TOTAL_TRADED_VALUE;
                parms[27].Value = item.PT_MATCH_QTTY;
                parms[28].Value = item.PT_MATCH_PRICE;
                parms[29].Value = item.PT_TOTAL_TRADED_QTTY;
                parms[30].Value = item.PT_TOTAL_TRADED_VALUE;
                parms[31].Value = item.TOTAL_BUY_TRADING_QTTY;
                parms[32].Value = item.BUY_COUNT;
                parms[33].Value = item.TOTAL_BUY_TRADING_VALUE;
                parms[34].Value = item.TOTAL_SELL_TRADING_QTTY;
                parms[35].Value = item.SELL_COUNT;
                parms[36].Value = item.TOTAL_SELL_TRADING_VALUE;
                parms[37].Value = item.TOTAL_TRADING_QTTY;
                parms[38].Value = item.TOTAL_TRADING_VALUE;
                parms[39].Value = item.BUY_FOREIGN_QTTY;
                parms[40].Value = item.BUY_FOREIGN_VALUE;
                parms[41].Value = item.SELL_FOREIGN_QTTY;
                parms[42].Value = item.SELL_FOREIGN_VALUE;
                parms[43].Value = item.REMAIN_FOREIGN_QTTY;
                parms[44].Value = item.CODE;


                SQLHelper.ExecuteNonQuery(_internalConnection, _internalADOTransaction, CommandType.StoredProcedure, "UpdateSTS_STOCKSINFOBYCODE", parms);
            }
            catch (Exception ex)
            {
                throw;
            }
        }

        public int CountSTS_MARKETINFO()
        {
            try
            {
                return Convert.ToInt32(SQLHelper.ExecuteScalar(_internalConnection, _internalADOTransaction, CommandType.StoredProcedure, "CountSTS_MARKETINFO"));
            }
            catch
            {
                throw;
            }
        }

        public int CountSTS_MARKETINFO_BYTIME(string time)
        {
            try
            {
                SqlParameter parm1 = new SqlParameter(PARM_TIME, SqlDbType.VarChar);
                parm1.Value = time;

                return Convert.ToInt32(SQLHelper.ExecuteScalarSingleParm(_internalConnection, _internalADOTransaction, CommandType.StoredProcedure, "CountSTS_MARKETINFO_BYTIME", parm1));
            }
            catch
            {
                throw;
            }
        }

        public void DeleteSTS_MARKETINFO()
        {
            try
            {
                SQLHelper.ExecuteNonQuery(_internalConnection, _internalADOTransaction, CommandType.StoredProcedure, "DeleteSTS_MARKETINFO");
            }
            catch
            {
                throw;
            }
        }

        public void InsertSTS_MARKETINFO(STS_MARKETINFO item)
        {
            try
            {
                SqlParameter[] parms = new SqlParameter[] { 
                        new SqlParameter( PARM_FLOOR_CODE,SqlDbType.VarChar),
                        new SqlParameter( PARM_DATE_NO,SqlDbType.Decimal),
                        new SqlParameter( PARM_TRADING_DATE,SqlDbType.DateTime),
                        new SqlParameter( PARM_CURRENT_STATUS,SqlDbType.Decimal),
                        new SqlParameter( PARM_TIME,SqlDbType.VarChar),
                        new SqlParameter( PARM_TOTAL_TRADE,SqlDbType.Decimal),
                        new SqlParameter( PARM_TOTAL_STOCK,SqlDbType.Decimal),
                        new SqlParameter( PARM_TOTAL_QTTY,SqlDbType.Decimal),
                        new SqlParameter( PARM_TOTAL_VALUE,SqlDbType.Decimal),
                        new SqlParameter( PARM_ADVANCES,SqlDbType.Decimal),
                        new SqlParameter( PARM_NOCHANGE,SqlDbType.Decimal),
                        new SqlParameter( PARM_DECLINES,SqlDbType.Decimal),
                        new SqlParameter( PARM_PRIOR_MARKET_INDEX,SqlDbType.Decimal),
                        new SqlParameter( PARM_CHG_INDEX,SqlDbType.Decimal),
                        new SqlParameter( PARM_PCT_INDEX,SqlDbType.Decimal),
                        new SqlParameter( PARM_CURRENT_INDEX,SqlDbType.Decimal),
                        new SqlParameter( PARM_MARKET_INDEX,SqlDbType.Decimal),
                        new SqlParameter( PARM_SESSION_NO,SqlDbType.VarChar),
                        new SqlParameter( PARM_PRV_PRIOR_MARKET_INDEX,SqlDbType.Decimal),
                        new SqlParameter( PARM_AVR_MARKET_INDEX,SqlDbType.Decimal),
                        new SqlParameter( PARM_AVR_PRIOR_MARKET_INDEX,SqlDbType.Decimal),
                        new SqlParameter( PARM_AVR_CHG_INDEX,SqlDbType.Decimal),
                        new SqlParameter( PARM_AVR_PCT_INDEX,SqlDbType.Decimal),
                        new SqlParameter( PARM_PT_TOTAL_QTTY,SqlDbType.Decimal),
                        new SqlParameter( PARM_PT_TOTAL_VALUE,SqlDbType.Decimal),
                        new SqlParameter( PARM_PT_TOTAL_TRADE,SqlDbType.Decimal)
                };

                parms[0].Value = item.FLOOR_CODE;
                parms[1].Value = item.DATE_NO;
                parms[2].Value = item.TRADING_DATE;
                parms[3].Value = item.CURRENT_STATUS;
                parms[4].Value = item.TIME;
                parms[5].Value = item.TOTAL_TRADE;
                parms[6].Value = item.TOTAL_STOCK;
                parms[7].Value = item.TOTAL_QTTY;
                parms[8].Value = item.TOTAL_VALUE;
                parms[9].Value = item.ADVANCES;
                parms[10].Value = item.NOCHANGE;
                parms[11].Value = item.DECLINES;
                parms[12].Value = item.PRIOR_MARKET_INDEX;
                parms[13].Value = item.CHG_INDEX;
                parms[14].Value = item.PCT_INDEX;
                parms[15].Value = item.CURRENT_INDEX;
                parms[16].Value = item.MARKET_INDEX;
                parms[17].Value = (item.SESSION_NO == null) ? "" : item.SESSION_NO;
                parms[18].Value = item.PRV_PRIOR_MARKET_INDEX;
                parms[19].Value = item.AVR_MARKET_INDEX;
                parms[20].Value = item.AVR_PRIOR_MARKET_INDEX;
                parms[21].Value = item.AVR_CHG_INDEX;
                parms[22].Value = item.AVR_PCT_INDEX;
                parms[23].Value = item.PT_TOTAL_QTTY;
                parms[24].Value = item.PT_TOTAL_VALUE;
                parms[25].Value = item.PT_TOTAL_TRADE;

                SQLHelper.ExecuteNonQuery(_internalConnection, _internalADOTransaction, CommandType.StoredProcedure, "InsertSTS_MARKETINFO", parms);
            }
            catch
            {
                throw;
            }
        }

        public void UpdateSTS_MARKETINFO(STS_MARKETINFO item)
        {
            try
            {
                SqlParameter[] parms = new SqlParameter[] { 
                        new SqlParameter( PARM_FLOOR_CODE,SqlDbType.VarChar),
                        new SqlParameter( PARM_DATE_NO,SqlDbType.Decimal),
                        new SqlParameter( PARM_TRADING_DATE,SqlDbType.DateTime),
                        new SqlParameter( PARM_CURRENT_STATUS,SqlDbType.Decimal),
                        new SqlParameter( PARM_TIME,SqlDbType.VarChar),
                        new SqlParameter( PARM_TOTAL_TRADE,SqlDbType.Decimal),
                        new SqlParameter( PARM_TOTAL_STOCK,SqlDbType.Decimal),
                        new SqlParameter( PARM_TOTAL_QTTY,SqlDbType.Decimal),
                        new SqlParameter( PARM_TOTAL_VALUE,SqlDbType.Decimal),
                        new SqlParameter( PARM_ADVANCES,SqlDbType.Decimal),
                        new SqlParameter( PARM_NOCHANGE,SqlDbType.Decimal),
                        new SqlParameter( PARM_DECLINES,SqlDbType.Decimal),
                        new SqlParameter( PARM_PRIOR_MARKET_INDEX,SqlDbType.Decimal),
                        new SqlParameter( PARM_CHG_INDEX,SqlDbType.Decimal),
                        new SqlParameter( PARM_PCT_INDEX,SqlDbType.Decimal),
                        new SqlParameter( PARM_CURRENT_INDEX,SqlDbType.Decimal),
                        new SqlParameter( PARM_MARKET_INDEX,SqlDbType.Decimal),
                        new SqlParameter( PARM_SESSION_NO,SqlDbType.VarChar),
                        new SqlParameter( PARM_PRV_PRIOR_MARKET_INDEX,SqlDbType.Decimal),
                        new SqlParameter( PARM_AVR_MARKET_INDEX,SqlDbType.Decimal),
                        new SqlParameter( PARM_AVR_PRIOR_MARKET_INDEX,SqlDbType.Decimal),
                        new SqlParameter( PARM_AVR_CHG_INDEX,SqlDbType.Decimal),
                        new SqlParameter( PARM_AVR_PCT_INDEX,SqlDbType.Decimal),
                        new SqlParameter( PARM_PT_TOTAL_QTTY,SqlDbType.Decimal),
                        new SqlParameter( PARM_PT_TOTAL_VALUE,SqlDbType.Decimal),
                        new SqlParameter( PARM_PT_TOTAL_TRADE,SqlDbType.Decimal)
                };

                parms[0].Value = item.FLOOR_CODE;
                parms[1].Value = item.DATE_NO;
                parms[2].Value = item.TRADING_DATE;
                parms[3].Value = item.CURRENT_STATUS;
                parms[4].Value = item.TIME;
                parms[5].Value = item.TOTAL_TRADE;
                parms[6].Value = item.TOTAL_STOCK;
                parms[7].Value = item.TOTAL_QTTY;
                parms[8].Value = item.TOTAL_VALUE;
                parms[9].Value = item.ADVANCES;
                parms[10].Value = item.NOCHANGE;
                parms[11].Value = item.DECLINES;
                parms[12].Value = item.PRIOR_MARKET_INDEX;
                parms[13].Value = item.CHG_INDEX;
                parms[14].Value = item.PCT_INDEX;
                parms[15].Value = item.CURRENT_INDEX;
                parms[16].Value = item.MARKET_INDEX;
                parms[17].Value = (item.SESSION_NO == null) ? "" : item.SESSION_NO; 
                parms[18].Value = item.PRV_PRIOR_MARKET_INDEX;
                parms[19].Value = item.AVR_MARKET_INDEX;
                parms[20].Value = item.AVR_PRIOR_MARKET_INDEX;
                parms[21].Value = item.AVR_CHG_INDEX;
                parms[22].Value = item.AVR_PCT_INDEX;
                parms[23].Value = item.PT_TOTAL_QTTY;
                parms[24].Value = item.PT_TOTAL_VALUE;
                parms[25].Value = item.PT_TOTAL_TRADE;


                SQLHelper.ExecuteNonQuery(_internalConnection, _internalADOTransaction, CommandType.StoredProcedure, "UpdateSTS_MARKETINFO", parms);
            }
            catch
            {
                throw;
            }
        }

        public int CountSTS_TOP3_PRICE_A()
        {
            try
            {
                return Convert.ToInt32(SQLHelper.ExecuteScalar(_internalConnection, _internalADOTransaction, CommandType.StoredProcedure, "CountSTS_TOP3_PRICE_A"));
            }
            catch
            {
                throw;
            }
        }

        public void DeleteSTS_TOP3_PRICE_A()
        {
            try
            {
                SQLHelper.ExecuteNonQuery(_internalConnection, _internalADOTransaction, CommandType.StoredProcedure, "DeleteSTS_TOP3_PRICE_A");
            }
            catch
            {
                throw;
            }
        }

        public void InsertSTS_TOP3_PRICE_A(STS_TOP3_PRICE_A item)
        {
            try
            {
                SqlParameter[] parms = new SqlParameter[] { 
                    new SqlParameter( PARM_STOCK_ID,SqlDbType.Decimal),
                    new SqlParameter( PARM_TRADING_DATE,SqlDbType.DateTime),
                    new SqlParameter( PARM_B_ORD_QTTY_3,SqlDbType.Decimal),
                    new SqlParameter( PARM_B_ORD_PRICE_3,SqlDbType.Decimal),
                    new SqlParameter( PARM_B_ORD_QTTY_2,SqlDbType.Decimal),
                    new SqlParameter( PARM_B_ORD_PRICE_2,SqlDbType.Decimal),
                    new SqlParameter( PARM_B_ORD_QTTY_1,SqlDbType.Decimal),
                    new SqlParameter( PARM_B_ORD_PRICE_1,SqlDbType.Decimal),
                    new SqlParameter( PARM_S_ORD_PRICE_1,SqlDbType.Decimal),
                    new SqlParameter( PARM_S_ORD_QTTY_1,SqlDbType.Decimal),
                    new SqlParameter( PARM_S_ORD_PRICE_2,SqlDbType.Decimal),
                    new SqlParameter( PARM_S_ORD_QTTY_2,SqlDbType.Decimal),
                    new SqlParameter( PARM_S_ORD_PRICE_3,SqlDbType.Decimal),
                    new SqlParameter( PARM_S_ORD_QTTY_3,SqlDbType.Decimal)
                };

                parms[0].Value = item.STOCK_ID;
                parms[1].Value = item.TRADING_DATE;
                parms[2].Value = item.B_ORD_QTTY_3;
                parms[3].Value = item.B_ORD_PRICE_3;
                parms[4].Value = item.B_ORD_QTTY_2;
                parms[5].Value = item.B_ORD_PRICE_2;
                parms[6].Value = item.B_ORD_QTTY_1;
                parms[7].Value = item.B_ORD_PRICE_1;
                parms[8].Value = item.S_ORD_PRICE_1;
                parms[9].Value = item.S_ORD_QTTY_1;
                parms[10].Value = item.S_ORD_PRICE_2;
                parms[11].Value = item.S_ORD_QTTY_2;
                parms[12].Value = item.S_ORD_PRICE_3;
                parms[13].Value = item.S_ORD_QTTY_3;


                SQLHelper.ExecuteNonQuery(_internalConnection, _internalADOTransaction, CommandType.StoredProcedure, "InsertSTS_TOP3_PRICE_A", parms);
            }
            catch
            {
                throw;
            }
        }

        public void UpdateSTS_TOP3_PRICE_A(STS_TOP3_PRICE_A item)
        {
            try
            {
                SqlParameter[] parms = new SqlParameter[] { 
                    new SqlParameter( PARM_STOCK_ID,SqlDbType.Decimal),
                    new SqlParameter( PARM_TRADING_DATE,SqlDbType.DateTime),
                    new SqlParameter( PARM_B_ORD_QTTY_3,SqlDbType.Decimal),
                    new SqlParameter( PARM_B_ORD_PRICE_3,SqlDbType.Decimal),
                    new SqlParameter( PARM_B_ORD_QTTY_2,SqlDbType.Decimal),
                    new SqlParameter( PARM_B_ORD_PRICE_2,SqlDbType.Decimal),
                    new SqlParameter( PARM_B_ORD_QTTY_1,SqlDbType.Decimal),
                    new SqlParameter( PARM_B_ORD_PRICE_1,SqlDbType.Decimal),
                    new SqlParameter( PARM_S_ORD_PRICE_1,SqlDbType.Decimal),
                    new SqlParameter( PARM_S_ORD_QTTY_1,SqlDbType.Decimal),
                    new SqlParameter( PARM_S_ORD_PRICE_2,SqlDbType.Decimal),
                    new SqlParameter( PARM_S_ORD_QTTY_2,SqlDbType.Decimal),
                    new SqlParameter( PARM_S_ORD_PRICE_3,SqlDbType.Decimal),
                    new SqlParameter( PARM_S_ORD_QTTY_3,SqlDbType.Decimal)
                };

                parms[0].Value = item.STOCK_ID;
                parms[1].Value = item.TRADING_DATE;
                parms[2].Value = item.B_ORD_QTTY_3;
                parms[3].Value = item.B_ORD_PRICE_3;
                parms[4].Value = item.B_ORD_QTTY_2;
                parms[5].Value = item.B_ORD_PRICE_2;
                parms[6].Value = item.B_ORD_QTTY_1;
                parms[7].Value = item.B_ORD_PRICE_1;
                parms[8].Value = item.S_ORD_PRICE_1;
                parms[9].Value = item.S_ORD_QTTY_1;
                parms[10].Value = item.S_ORD_PRICE_2;
                parms[11].Value = item.S_ORD_QTTY_2;
                parms[12].Value = item.S_ORD_PRICE_3;
                parms[13].Value = item.S_ORD_QTTY_3;


                SQLHelper.ExecuteNonQuery(_internalConnection, _internalADOTransaction, CommandType.StoredProcedure, "UpdateSTS_TOP3_PRICE_A", parms);
            }
            catch
            {
                throw;
            }
        }

        public int CountSTS_TOP3_PRICE_B()
        {
            try
            {
                return Convert.ToInt32(SQLHelper.ExecuteScalar(_internalConnection, _internalADOTransaction, CommandType.StoredProcedure, "CountSTS_TOP3_PRICE_B"));
            }
            catch
            {
                throw;
            }
        }

        public void DeleteSTS_TOP3_PRICE_B()
        {
            try
            {
                SQLHelper.ExecuteNonQuery(_internalConnection, _internalADOTransaction, CommandType.StoredProcedure, "DeleteSTS_TOP3_PRICE_B");
            }
            catch
            {
                throw;
            }
        }

        public void InsertSTS_TOP3_PRICE_B(STS_TOP3_PRICE_B item)
        {
            try
            {
                SqlParameter[] parms = new SqlParameter[] { 
                        new SqlParameter( PARM_STOCK_ID,SqlDbType.Decimal),
                        new SqlParameter( PARM_TRADING_DATE,SqlDbType.DateTime),
                        new SqlParameter( PARM_ORDER_QTTY_SELL,SqlDbType.Decimal),
                        new SqlParameter( PARM_ORDER_PRICE_SELL,SqlDbType.Decimal),
                        new SqlParameter( PARM_YIELDMAT_SELL,SqlDbType.Decimal),
                        new SqlParameter( PARM_ORDER_QTTY_BUY,SqlDbType.Decimal),
                        new SqlParameter( PARM_ORDER_PRICE_BUY,SqlDbType.Decimal),
                        new SqlParameter( PARM_YIELDMAT_BUY,SqlDbType.Decimal)
                };

                parms[0].Value = item.STOCK_ID;
                parms[1].Value = item.TRADING_DATE;
                parms[2].Value = item.ORDER_QTTY_SELL;
                parms[3].Value = item.ORDER_PRICE_SELL;
                parms[4].Value = item.YIELDMAT_SELL;
                parms[5].Value = item.ORDER_QTTY_BUY;
                parms[6].Value = item.ORDER_PRICE_BUY;
                parms[7].Value = item.YIELDMAT_BUY;


                SQLHelper.ExecuteNonQuery(_internalConnection, _internalADOTransaction, CommandType.StoredProcedure, "InsertSTS_TOP3_PRICE_B", parms);
            }
            catch
            {
                throw;
            }
        }

        public void UpdateSTS_TOP3_PRICE_B(STS_TOP3_PRICE_B item)
        {
            try
            {
                SqlParameter[] parms = new SqlParameter[] { 
                        new SqlParameter( PARM_STOCK_ID,SqlDbType.Decimal),
                        new SqlParameter( PARM_TRADING_DATE,SqlDbType.DateTime),
                        new SqlParameter( PARM_ORDER_QTTY_SELL,SqlDbType.Decimal),
                        new SqlParameter( PARM_ORDER_PRICE_SELL,SqlDbType.Decimal),
                        new SqlParameter( PARM_YIELDMAT_SELL,SqlDbType.Decimal),
                        new SqlParameter( PARM_ORDER_QTTY_BUY,SqlDbType.Decimal),
                        new SqlParameter( PARM_ORDER_PRICE_BUY,SqlDbType.Decimal),
                        new SqlParameter( PARM_YIELDMAT_BUY,SqlDbType.Decimal)
                };

                parms[0].Value = item.STOCK_ID;
                parms[1].Value = item.TRADING_DATE;
                parms[2].Value = item.ORDER_QTTY_SELL;
                parms[3].Value = item.ORDER_PRICE_SELL;
                parms[4].Value = item.YIELDMAT_SELL;
                parms[5].Value = item.ORDER_QTTY_BUY;
                parms[6].Value = item.ORDER_PRICE_BUY;
                parms[7].Value = item.YIELDMAT_BUY;

                SQLHelper.ExecuteNonQuery(_internalConnection, _internalADOTransaction, CommandType.StoredProcedure, "UpdateSTS_TOP3_PRICE_B", parms);
            }
            catch
            {
                throw;
            }
        }

        public int CountSTS_ORDERS()
        {
            try
            {
                return Convert.ToInt32(SQLHelper.ExecuteScalar(_internalConnection, _internalADOTransaction, CommandType.StoredProcedure, "CountSTS_ORDERS"));
            }
            catch
            {
                throw;
            }
        }

        public void DeleteSTS_ORDERS()
        {
            try
            {
                SQLHelper.ExecuteNonQuery(_internalConnection, _internalADOTransaction, CommandType.StoredProcedure, "DeleteSTS_ORDERS");
            }
            catch
            {
                throw;
            }
        }

        public void InsertSTS_ORDERS(STS_ORDERS item)
        {
            try
            {
                SqlParameter[] parms = new SqlParameter[] { 
                    new SqlParameter( PARM_FLOOR_CODE,SqlDbType.VarChar),
                    new SqlParameter( PARM_ORDER_NO,SqlDbType.VarChar),
                    new SqlParameter( PARM_ORDER_DATE,SqlDbType.DateTime),
                    new SqlParameter( PARM_ORDER_TIME,SqlDbType.VarChar),
                    new SqlParameter( PARM_MEMBER_ID,SqlDbType.Decimal),
                    new SqlParameter( PARM_ACCOUNT_ID,SqlDbType.Decimal),
                    new SqlParameter( PARM_STOCK_ID,SqlDbType.Decimal),
                    new SqlParameter( PARM_ORDER_TYPE,SqlDbType.Decimal),
                    new SqlParameter( PARM_PRIORITY,SqlDbType.Decimal),
                    new SqlParameter( PARM_OORB,SqlDbType.Decimal),
                    new SqlParameter( PARM_NORP,SqlDbType.Decimal),
                    new SqlParameter( PARM_NORC,SqlDbType.Decimal),
                    new SqlParameter( PARM_BORE,SqlDbType.Decimal),
                    new SqlParameter( PARM_AORI,SqlDbType.Decimal),
                    new SqlParameter( PARM_SETTLEMENT_TYPE,SqlDbType.Decimal),
                    new SqlParameter( PARM_DORF,SqlDbType.Decimal),
                    new SqlParameter( PARM_ORDER_QTTY,SqlDbType.Decimal),
                    new SqlParameter( PARM_ORDER_PRICE,SqlDbType.Decimal),
                    new SqlParameter( PARM_STATUS,SqlDbType.Decimal),
                    new SqlParameter( PARM_QUOTE_PRICE,SqlDbType.Decimal),
                    new SqlParameter( PARM_QUOTE_TIME,SqlDbType.Decimal),
                    new SqlParameter( PARM_QUOTE_QTTY,SqlDbType.Decimal),
                    new SqlParameter( PARM_ACCOUNT_NO,SqlDbType.VarChar),
                    new SqlParameter( PARM_BROKER_ID,SqlDbType.Decimal),
                    new SqlParameter( PARM_TELEPHONE,SqlDbType.Decimal),
                    new SqlParameter( PARM_SESSION_NO,SqlDbType.VarChar),
                    new SqlParameter( PARM_SETTLE_DAY,SqlDbType.Decimal),
                    new SqlParameter( PARM_AORC,SqlDbType.Decimal),
                    new SqlParameter( PARM_YIELDMAT,SqlDbType.Decimal),
                    new SqlParameter( PARM_CODE_TRADE,SqlDbType.VarChar)
                };

                parms[0].Value = item.FLOOR_CODE;
                parms[1].Value = item.ORDER_NO;
                parms[2].Value = item.ORDER_DATE;
                parms[3].Value = item.ORDER_TIME;
                parms[4].Value = item.MEMBER_ID;
                parms[5].Value = item.ACCOUNT_ID;
                parms[6].Value = item.STOCK_ID;
                parms[7].Value = item.ORDER_TYPE;
                parms[8].Value = item.PRIORITY;
                parms[9].Value = item.OORB;
                parms[10].Value = item.NORP;
                parms[11].Value = item.NORC;
                parms[12].Value = item.BORE;
                parms[13].Value = item.AORI;
                parms[14].Value = item.SETTLEMENT_TYPE;
                parms[15].Value = item.DORF;
                parms[16].Value = item.ORDER_QTTY;
                parms[17].Value = item.ORDER_PRICE;
                parms[18].Value = item.STATUS;
                parms[19].Value = item.QUOTE_PRICE;
                parms[20].Value = item.QUOTE_TIME;
                parms[21].Value = item.QUOTE_QTTY;
                parms[22].Value = item.ACCOUNT_NO;
                parms[23].Value = item.BROKER_ID;
                parms[24].Value = item.TELEPHONE;
                parms[25].Value = (item.SESSION_NO == null) ? "" : item.SESSION_NO;
                parms[26].Value = item.SETTLE_DAY;
                parms[27].Value = item.AORC;
                parms[28].Value = item.YIELDMAT;
                parms[29].Value = item.CODE_TRADE;



                SQLHelper.ExecuteNonQuery(_internalConnection, _internalADOTransaction, CommandType.StoredProcedure, "InsertSTS_ORDERS", parms);
            }
            catch
            {
                throw;
            }
        }

        public void UpdateSTS_ORDERS(STS_ORDERS item)
        {
            try
            {
                SqlParameter[] parms = new SqlParameter[] { 
                    new SqlParameter( PARM_FLOOR_CODE,SqlDbType.VarChar),
                    new SqlParameter( PARM_ORDER_NO,SqlDbType.VarChar),
                    new SqlParameter( PARM_ORDER_DATE,SqlDbType.DateTime),
                    new SqlParameter( PARM_ORDER_TIME,SqlDbType.VarChar),
                    new SqlParameter( PARM_MEMBER_ID,SqlDbType.Decimal),
                    new SqlParameter( PARM_ACCOUNT_ID,SqlDbType.Decimal),
                    new SqlParameter( PARM_STOCK_ID,SqlDbType.Decimal),
                    new SqlParameter( PARM_ORDER_TYPE,SqlDbType.Decimal),
                    new SqlParameter( PARM_PRIORITY,SqlDbType.Decimal),
                    new SqlParameter( PARM_OORB,SqlDbType.Decimal),
                    new SqlParameter( PARM_NORP,SqlDbType.Decimal),
                    new SqlParameter( PARM_NORC,SqlDbType.Decimal),
                    new SqlParameter( PARM_BORE,SqlDbType.Decimal),
                    new SqlParameter( PARM_AORI,SqlDbType.Decimal),
                    new SqlParameter( PARM_SETTLEMENT_TYPE,SqlDbType.Decimal),
                    new SqlParameter( PARM_DORF,SqlDbType.Decimal),
                    new SqlParameter( PARM_ORDER_QTTY,SqlDbType.Decimal),
                    new SqlParameter( PARM_ORDER_PRICE,SqlDbType.Decimal),
                    new SqlParameter( PARM_STATUS,SqlDbType.Decimal),
                    new SqlParameter( PARM_QUOTE_PRICE,SqlDbType.Decimal),
                    new SqlParameter( PARM_QUOTE_TIME,SqlDbType.Decimal),
                    new SqlParameter( PARM_QUOTE_QTTY,SqlDbType.Decimal),
                    new SqlParameter( PARM_ACCOUNT_NO,SqlDbType.VarChar),
                    new SqlParameter( PARM_BROKER_ID,SqlDbType.Decimal),
                    new SqlParameter( PARM_TELEPHONE,SqlDbType.Decimal),
                    new SqlParameter( PARM_SESSION_NO,SqlDbType.VarChar),
                    new SqlParameter( PARM_SETTLE_DAY,SqlDbType.Decimal),
                    new SqlParameter( PARM_AORC,SqlDbType.Decimal),
                    new SqlParameter( PARM_YIELDMAT,SqlDbType.Decimal),
                    new SqlParameter( PARM_CODE_TRADE,SqlDbType.VarChar)
                };

                parms[0].Value = item.FLOOR_CODE;
                parms[1].Value = item.ORDER_NO;
                parms[2].Value = item.ORDER_DATE;
                parms[3].Value = item.ORDER_TIME;
                parms[4].Value = item.MEMBER_ID;
                parms[5].Value = item.ACCOUNT_ID;
                parms[6].Value = item.STOCK_ID;
                parms[7].Value = item.ORDER_TYPE;
                parms[8].Value = item.PRIORITY;
                parms[9].Value = item.OORB;
                parms[10].Value = item.NORP;
                parms[11].Value = item.NORC;
                parms[12].Value = item.BORE;
                parms[13].Value = item.AORI;
                parms[14].Value = item.SETTLEMENT_TYPE;
                parms[15].Value = item.DORF;
                parms[16].Value = item.ORDER_QTTY;
                parms[17].Value = item.ORDER_PRICE;
                parms[18].Value = item.STATUS;
                parms[19].Value = item.QUOTE_PRICE;
                parms[20].Value = item.QUOTE_TIME;
                parms[21].Value = item.QUOTE_QTTY;
                parms[22].Value = item.ACCOUNT_NO;
                parms[23].Value = item.BROKER_ID;
                parms[24].Value = item.TELEPHONE;
                parms[25].Value = (item.SESSION_NO == null) ? "" : item.SESSION_NO;
                parms[26].Value = item.SETTLE_DAY;
                parms[27].Value = item.AORC;
                parms[28].Value = item.YIELDMAT;
                parms[29].Value = item.CODE_TRADE;



                SQLHelper.ExecuteNonQuery(_internalConnection, _internalADOTransaction, CommandType.StoredProcedure, "UpdateSTS_ORDERS", parms);
            }
            catch
            {
                throw;
            }
        }

        public int CountSTS_TRADING_RESULT()
        {
            try
            {
                return Convert.ToInt32(SQLHelper.ExecuteScalar(_internalConnection, _internalADOTransaction, CommandType.StoredProcedure, "CountSTS_TRADING_RESULT"));
            }
            catch
            {
                throw;
            }
        }

        public void DeleteSTS_TRADING_RESULT()
        {
            try
            {
                SQLHelper.ExecuteNonQuery(_internalConnection, _internalADOTransaction, CommandType.StoredProcedure, "DeleteSTS_TRADING_RESULT");
            }
            catch
            {
                throw;
            }
        }

        public void InsertSTS_TRADING_RESULT(STS_TRADING_RESULT item)
        {
            try
            {
                SqlParameter[] parms = new SqlParameter[] { 
                        new SqlParameter( PARM_FLOOR_CODE,SqlDbType.VarChar),
                        new SqlParameter( PARM_TRADING_DATE,SqlDbType.DateTime),
                        new SqlParameter( PARM_CONFIRM_NO,SqlDbType.VarChar),
                        new SqlParameter( PARM_B_ORDER_NO,SqlDbType.VarChar),
                        new SqlParameter( PARM_B_ORDER_DATE,SqlDbType.DateTime),
                        new SqlParameter( PARM_S_ORDER_NO,SqlDbType.VarChar),
                        new SqlParameter( PARM_S_ORDER_DATE,SqlDbType.DateTime),
                        new SqlParameter( PARM_B_NEXT_CNFRM,SqlDbType.Decimal),
                        new SqlParameter( PARM_S_NEXT_CNFRM,SqlDbType.Decimal),
                        new SqlParameter( PARM_MATCH_TIME,SqlDbType.VarChar),
                        new SqlParameter( PARM_MATCH_DATE,SqlDbType.DateTime),
                        new SqlParameter( PARM_B_TRADING_ID,SqlDbType.Decimal),
                        new SqlParameter( PARM_S_TRADING_ID,SqlDbType.Decimal),
                        new SqlParameter( PARM_B_CODE_TRADE,SqlDbType.VarChar),
                        new SqlParameter( PARM_S_CODE_TRADE,SqlDbType.VarChar),
                        new SqlParameter( PARM_STATUS,SqlDbType.Decimal),
                        new SqlParameter( PARM_SEC_CODE,SqlDbType.VarChar),
                        new SqlParameter( PARM_QUANTITY,SqlDbType.Decimal),
                        new SqlParameter( PARM_PRICE,SqlDbType.Decimal),
                        new SqlParameter( PARM_B_ACCOUNT_NO,SqlDbType.VarChar),
                        new SqlParameter( PARM_S_ACCOUNT_NO,SqlDbType.VarChar),
                        new SqlParameter( PARM_SETT_TYPE,SqlDbType.Decimal),
                        new SqlParameter( PARM_SETT_DATE,SqlDbType.Decimal),
                        new SqlParameter( PARM_B_PC_FLAG,SqlDbType.VarChar),
                        new SqlParameter( PARM_S_PC_FLAG,SqlDbType.VarChar),
                        new SqlParameter( PARM_NORP,SqlDbType.Decimal)

                };

                parms[0].Value = item.FLOOR_CODE;
                parms[1].Value = item.TRADING_DATE;
                parms[2].Value = item.CONFIRM_NO;
                parms[3].Value = item.B_ORDER_NO;
                parms[4].Value = item.B_ORDER_DATE;
                parms[5].Value = item.S_ORDER_NO;
                parms[6].Value = item.S_ORDER_DATE;
                parms[7].Value = item.B_NEXT_CNFRM;
                parms[8].Value = item.S_NEXT_CNFRM;
                parms[9].Value = item.MATCH_TIME;
                parms[10].Value = item.MATCH_DATE;
                parms[11].Value = item.B_TRADING_ID;
                parms[12].Value = item.S_TRADING_ID;
                parms[13].Value = item.B_CODE_TRADE;
                parms[14].Value = item.S_CODE_TRADE;
                parms[15].Value = item.STATUS;
                parms[16].Value = item.SEC_CODE;
                parms[17].Value = item.QUANTITY;
                parms[18].Value = item.PRICE;
                parms[19].Value = item.B_ACCOUNT_NO;
                parms[20].Value = item.S_ACCOUNT_NO;
                parms[21].Value = item.SETT_TYPE;
                parms[22].Value = item.SETT_DATE;
                parms[23].Value = item.B_PC_FLAG;
                parms[24].Value = item.S_PC_FLAG;
                parms[25].Value = item.NORP;


                SQLHelper.ExecuteNonQuery(_internalConnection, _internalADOTransaction, CommandType.StoredProcedure, "InsertSTS_TRADING_RESULT", parms);
            }
            catch (Exception ex)
            {
                throw;
            }
        }

        public void UpdateSTS_TRADING_RESULT(STS_TRADING_RESULT item)
        {
            try
            {
                SqlParameter[] parms = new SqlParameter[] { 
                new SqlParameter( PARM_FLOOR_CODE,SqlDbType.VarChar),
                new SqlParameter( PARM_TRADING_DATE,SqlDbType.DateTime),
                new SqlParameter( PARM_CONFIRM_NO,SqlDbType.VarChar),
                new SqlParameter( PARM_B_ORDER_NO,SqlDbType.VarChar),
                new SqlParameter( PARM_B_ORDER_DATE,SqlDbType.DateTime),
                new SqlParameter( PARM_S_ORDER_NO,SqlDbType.VarChar),
                new SqlParameter( PARM_S_ORDER_DATE,SqlDbType.DateTime),
                new SqlParameter( PARM_B_NEXT_CNFRM,SqlDbType.Decimal),
                new SqlParameter( PARM_S_NEXT_CNFRM,SqlDbType.Decimal),
                new SqlParameter( PARM_MATCH_TIME,SqlDbType.VarChar),
                new SqlParameter( PARM_MATCH_DATE,SqlDbType.DateTime),
                new SqlParameter( PARM_B_TRADING_ID,SqlDbType.Decimal),
                new SqlParameter( PARM_S_TRADING_ID,SqlDbType.Decimal),
                new SqlParameter( PARM_B_CODE_TRADE,SqlDbType.VarChar),
                new SqlParameter( PARM_S_CODE_TRADE,SqlDbType.VarChar),
                new SqlParameter( PARM_STATUS,SqlDbType.Decimal),
                new SqlParameter( PARM_SEC_CODE,SqlDbType.Decimal),
                new SqlParameter( PARM_QUANTITY,SqlDbType.Decimal),
                new SqlParameter( PARM_PRICE,SqlDbType.Decimal),
                new SqlParameter( PARM_B_ACCOUNT_NO,SqlDbType.VarChar),
                new SqlParameter( PARM_S_ACCOUNT_NO,SqlDbType.VarChar),
                new SqlParameter( PARM_SETT_TYPE,SqlDbType.Decimal),
                new SqlParameter( PARM_SETT_DATE,SqlDbType.Decimal),
                new SqlParameter( PARM_B_PC_FLAG,SqlDbType.VarChar),
                new SqlParameter( PARM_S_PC_FLAG,SqlDbType.VarChar),
                new SqlParameter( PARM_NORP,SqlDbType.Decimal)

                };

                parms[0].Value = item.FLOOR_CODE;
                parms[1].Value = item.TRADING_DATE;
                parms[2].Value = item.CONFIRM_NO;
                parms[3].Value = item.B_ORDER_NO;
                parms[4].Value = item.B_ORDER_DATE;
                parms[5].Value = item.S_ORDER_NO;
                parms[6].Value = item.S_ORDER_DATE;
                parms[7].Value = item.B_NEXT_CNFRM;
                parms[8].Value = item.S_NEXT_CNFRM;
                parms[9].Value = item.MATCH_TIME;
                parms[10].Value = item.MATCH_DATE;
                parms[11].Value = item.B_TRADING_ID;
                parms[12].Value = item.S_TRADING_ID;
                parms[13].Value = item.B_CODE_TRADE;
                parms[14].Value = item.S_CODE_TRADE;
                parms[15].Value = item.STATUS;
                parms[16].Value = item.SEC_CODE;
                parms[17].Value = item.QUANTITY;
                parms[18].Value = item.PRICE;
                parms[19].Value = item.B_ACCOUNT_NO;
                parms[20].Value = item.S_ACCOUNT_NO;
                parms[21].Value = item.SETT_TYPE;
                parms[22].Value = item.SETT_DATE;
                parms[23].Value = item.B_PC_FLAG;
                parms[24].Value = item.S_PC_FLAG;
                parms[25].Value = item.NORP;


                SQLHelper.ExecuteNonQuery(_internalConnection, _internalADOTransaction, CommandType.StoredProcedure, "UpdateSTS_TRADING_RESULT", parms);
            }
            catch
            {
                throw;
            }
        }

        public int CountSTS_LE_ByCode(string code, decimal totalqtty)
        {
            try
            {
                SqlParameter[] parms = new SqlParameter[] { 
                    new SqlParameter(PARM_CODE, SqlDbType.VarChar),
                    new SqlParameter(PARM_TOTAL_TRADING_QTTY, SqlDbType.Decimal)
                };

                parms[0].Value = code;
                parms[1].Value = totalqtty;

                return Convert.ToInt32(SQLHelper.ExecuteScalar(_internalConnection, _internalADOTransaction, CommandType.StoredProcedure, "CountSTS_LE_BYCODE", parms));
            }
            catch
            {
                throw;
            }
        }

        public int CountSTS_LE()
        {
            try
            {
                return Convert.ToInt32(SQLHelper.ExecuteScalarNoParm(_internalConnection, _internalADOTransaction, CommandType.StoredProcedure, "CountSTS_LE"));
            }
            catch
            {
                throw;
            }
        }

        public void DeleteSTS_LE()
        {
            try
            {
                SQLHelper.ExecuteNonQuery(_internalConnection, _internalADOTransaction, CommandType.StoredProcedure, "DeleteSTS_LE");
            }
            catch
            {
                throw;
            }
        }

        public void InsertSTS_LE(STS_LE item)
        {
            try
            {
                SqlParameter[] parms = new SqlParameter[] { 
                    new SqlParameter(PARM_TIME, SqlDbType.DateTime),
                    new SqlParameter(PARM_CODE, SqlDbType.VarChar),
                    new SqlParameter(PARM_STOCK_ID, SqlDbType.Decimal),
                    new SqlParameter(PARM_PRICE, SqlDbType.Decimal),
                    new SqlParameter(PARM_QUANTITY , SqlDbType.Decimal),
                    new SqlParameter(PARM_HIGHEST_PRICE, SqlDbType.Decimal),
                    new SqlParameter(PARM_LOWEST_PRICE, SqlDbType.Decimal),
                    new SqlParameter(PARM_TOTAL_TRADING_QTTY, SqlDbType.Decimal)
                };

                parms[0].Value = item.TIME;
                parms[1].Value = item.CODE;
                parms[2].Value = item.STOCK_ID;
                parms[3].Value = item.PRICE;
                parms[4].Value = item.QUANTITY;
                parms[5].Value = item.HIGHEST_PRICE;
                parms[6].Value = item.LOWEST_PRICE;
                parms[7].Value = item.TOTAL_TRADING_QTTY;

                SQLHelper.ExecuteNonQuery(_internalConnection, _internalADOTransaction, CommandType.StoredProcedure, "InsertSTS_LE", parms);
            }
            catch (Exception ex)
            {
                throw;
            }
        }

        public void InsertSTS_LE(DateTime time, string code, decimal stockid, decimal price, decimal quantity, decimal high, decimal low, decimal total)
        {

        }

        #endregion

        /// <summary>
        /// Works on transaction date only
        /// </summary>
        public void BackupHastc()
        {
            try
            {
                SQLHelper.ExecuteNonQuery(_internalConnection, _internalADOTransaction, CommandType.StoredProcedure, "_BackupHastc");
            }
            catch
            {
                throw;
            }
        }
        public void ClearHastc()
        {
            try
            {
                SQLHelper.ExecuteNonQuery(_internalConnection, _internalADOTransaction, CommandType.StoredProcedure, "_ClearHastc");
            }
            catch
            {
                throw;
            }
        }

    }
}
